import Vue from 'vue'
import Router from 'vue-router'
import Login from './views/Login.vue'
import Home from './views/Home.vue'
import Wel from './views/Wel.vue'
import User from './views/user/Index.vue'
import Rights from '@/views/right/rightlist.vue'
import Roles from '@/views/right/rolelist.vue'
import Good from '@/views/good/goods.vue'
import List from '@/views/good/list.vue'
import Add from '@/views/good/add.vue'
Vue.use(Router)

var router = new Router({
  routes: [
    {
      name: 'login',
      path: '/login',
      component: Login
    },
    {
      path: '/',
      redirect: { name: 'home' }
    },
    {
      name: 'home',
      path: '/home',
      component: Home,
      redirect: { path: 'home/wel' },
      children: [
        {
          path: 'wel',
          component: Wel
        },
        {
          name: 'user',
          path: 'user',
          component: User
        },
        {
          name: 'rights',
          path: 'rights',
          component: Rights
        },
        {
          name: 'roles',
          path: 'roles',
          component: Roles
        },
        {
          name: 'good',
          path: 'goods',
          component: Good,
          redirect: { name: 'list' },
          children: [
            {
              name: 'list',
              path: 'lists',
              component: List
            },
            {
              name: 'add',
              path: 'add',
              component: Add
            }
          ]
        }
      ]

    }
  ]
})
export default router
